<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Continue</title>
		<link rel="stylesheet" type="text/css" href="css/global.css" />
		<link rel="stylesheet" type="text/css" href="css/continue.css"/>
		<link rel="stylesheet" type="text/css" href="plugins/bootstrap-3.3.7-dist/css/bootstrap.min.css"/>
		<script src="vue.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div class="list-group" id="file_list" style="text-align: center;">
			<a href="index.html" class="list-group-item">Back</a>
			<a v-for="package in packages" v-bind:href="package.link" class="list-group-item">{{ package.name }}</a>
		</div>
		
		<script type="text/javascript">
			var fs = require('fs');
			
			new Vue({
				el: '#file_list',
				data: function () {
					if (!fs.existsSync('./archives/')) {
						fs.mkdirSync('./archives/');
					}
					var _files = fs.readdirSync('./archives/');
					var _packages = [];
					for (var index in _files) {
						var file = _files[index];
						var file_name_array = file.split('.');
						var file_ext_name = file_name_array[file_name_array.length - 1];
						if (file_ext_name === 'json') {
							_packages.push({
								link: 'select.html?archive=' + file,
								name: file,
							});
						}
					}
					return {
						packages: _packages,
					};
				}
			});
		</script>
	</body>
</html>
